import Vue from 'vue'
import Router from 'vue-router'
import commonApi from '@/view/apiConfig.js'

Vue.use(Router)

const route = new Router({
    routes: [
        {
            path: '/cellChange',
            name: 'cellChange',
            component: () => import('@/view/reportForms/cellChange.vue'),
            meta: {
                title: '小区调整工单报表'
            }
        },
        {
            path: '/unElcCell',
            name: 'unElcCell',
            component: () => import('@/view/reportForms/unElcCell.vue'),
            meta: {
                title: '非电调参数调整报表'
            }
        },
        {
            path: '/alarmStatic',
            name: 'alarmStatic',
            component: () => import('@/view/reportForms/alarmStatic.vue'),
            meta: {
                title: '告警统计'
            }
        }
    ]
})
// 在beforeEach导航守卫中调用接口
// eslint-disable-next-line space-before-function-paren
route.beforeEach(async (to, from, next) => {
    /* 路由发生变化修改页面title */
    if (to.meta.title) {
        document.title = to.meta.title
    }
    // await commonApi.saveOperateLog({ url: to.path })
    next()
})
export default route
